Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UTF-8 validation fast paths in Wtf8Buf #137154

Merged
merged 2 commits into from
Feb 26, 2025

Conversation

thaliaarchi
Copy link
Contributor

This adds two more fast paths for UTF-8 validation in Wtf8Buf, making use of the is_known_utf8 flag added in #96869 (Optimize Wtf8Buf::into_string for the case where it contains UTF-8).

r? @ChrisDenton

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 16, 2025
Copy link
Member

@ChrisDenton ChrisDenton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have one very small nit but otherwise it looks good to me.

Comment on lines 173 to 176
if let Some(s) = self.as_known_utf8() {
return fmt::Display::fmt(s, formatter);
}
fmt::Display::fmt(&**self, formatter)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could just be an if/else rather than early return

@thaliaarchi
Copy link
Contributor Author

Now that #137155 is finally through the merge queue, I've addressed your feedback and rebased onto it to resolve conflicts.

@ChrisDenton
Copy link
Member

Ok, looks good!

@bors r+

@bors
Copy link
Contributor

bors commented Feb 25, 2025

📌 Commit eb14652 has been approved by ChrisDenton

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 25, 2025
@ChrisDenton
Copy link
Member

@bors rollup because it's small

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 26, 2025
Rollup of 14 pull requests

Successful merges:

 - rust-lang#136576 (pass optimization level to llvm-bitcode-linker)
 - rust-lang#137154 (Add UTF-8 validation fast paths in `Wtf8Buf`)
 - rust-lang#137311 (Enable `f16` for MIPS)
 - rust-lang#137320 (fix(rustdoc): Fixed stability version in rustdoc)
 - rust-lang#137529 (remove few unused args)
 - rust-lang#137544 (tests: Add regression test for derive token invalidation (rust-lang#81099))
 - rust-lang#137559 (run some tests on emscripten again)
 - rust-lang#137601 (ssa/mono: deduplicate `type_has_metadata`)
 - rust-lang#137603 (codegen_llvm: avoid `Deref` impls w/ extern type)
 - rust-lang#137604 (trait_sel: resolve vars in host effects)
 - rust-lang#137609 (Complete the list of resources used in rustdoc output)
 - rust-lang#137613 (hir_analysis: skip self type of host effect preds in variances_of)
 - rust-lang#137614 (fix doc in library/core/src/pin.rs)
 - rust-lang#137622 (fix attribute-related ICE when parsing macro on the rhs of a name-value attribute)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e121dcf into rust-lang:master Feb 26, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Feb 26, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 26, 2025
Rollup merge of rust-lang#137154 - thaliaarchi:wtf8-fast-paths, r=ChrisDenton

Add UTF-8 validation fast paths in `Wtf8Buf`

This adds two more fast paths for UTF-8 validation in `Wtf8Buf`, making use of the `is_known_utf8` flag added in rust-lang#96869 (Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8).

r? `@ChrisDenton`
@thaliaarchi thaliaarchi deleted the wtf8-fast-paths branch February 26, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants